<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns:cc="http://java.sun.com/jsf/composite"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:p="http://primefaces.org/ui"
       xmlns:f="http://java.sun.com/jsf/core">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="bill" />
        <cc:attribute name="billController" />
        <cc:attribute name="dup" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>

        <div >

            <div >
                <div >


                    <h:outputStylesheet name="printing.css" library="css" />
                    <p:commandButton value="Print" ajax="false" action="#"  >
                        <p:printer target="gpBillPreview" ></p:printer>
                    </p:commandButton>


                    <div class="fiveinchbillBreakRuhunu" >

                        <p:panel   id="gpBillPreview" style="border: none;"  >


                            <div style="position: absolute!important;left: 60%!important; font-weight: bold!important;
                                 top: 0%!important;font-size: 15px!important; text-decoration: underline!important;">
                                <h:outputLabel value="Receipt"   />                           
                            </div>

                            <div style="position: absolute;
                                 left: 0%!important;
                                 top: 7%!important;
                                 font-size: 12px!important;">
                                <h:outputLabel value="Receipt No"/>
                            </div>
                            <div style="position: absolute;
                                 left: 23%;
                                 top: 7%;
                                 font-size:12px!important;">
                                <h:outputLabel value=":"/>
                            </div>
                            <div style="position: absolute;
                                 left: 25%!important;
                                 top: 7%!important;
                                 font-size: 12px!important;">                                                 
                                <h:outputLabel value="#{cc.attrs.bill.cancelledBill.insId} **Cancelled"  
                                               rendered="#{cc.attrs.bill.cancelledBill.insId ne null}"/> 
                                <h:outputLabel value="#{cc.attrs.bill.insId}" 
                                               rendered="#{cc.attrs.bill.cancelledBill.insId eq null}"/>  
                                <h:outputLabel value="  **Duplicate" 
                                               rendered="#{cc.attrs.bill.cancelledBill.insId eq null and cc.attrs.dup eq true }" />
                            </div>

                            <div style="position: absolute;
                                 left: 73%!important;
                                 top: 7%!important;
                                 font-size: 12px!important;">
                                <h:outputLabel value="Date"/>
                            </div>
                            <div style="position: absolute;
                                 left: 82%;
                                 top: 7%;
                                 font-size:12px!important;">
                                <h:outputLabel value=":"/>
                            </div>
                            <div style="position: absolute;
                                 left: 84%!important;
                                 top: 7%!important;
                                 font-size: 12px!important;" >                  
                                <h:outputLabel value="#{cc.attrs.bill.cancelledBill.billDate}"
                                               rendered="#{cc.attrs.bill.cancelledBill.insId ne null}"  >
                                    <f:convertDateTime pattern="dd/MM/yy"/>
                                </h:outputLabel>                      
                                <h:outputLabel value="#{cc.attrs.bill.billDate}"
                                               rendered="#{cc.attrs.bill.cancelledBill.insId eq null }">
                                    <f:convertDateTime pattern="dd/MM/yy"/>
                                </h:outputLabel>
                            </div>

                            <div style="position: absolute;
                                 left: 0%!important;
                                 top: 11%!important;
                                 font-size: 12px!important;">
                                <h:outputLabel value="Payment Type"/>
                            </div>
                            <div style="position: absolute;
                                 left: 23%;
                                 top: 11%;
                                 font-size:12px!important;">
                                <h:outputLabel value=":"/>
                            </div>
                            <div style="position: absolute;
                                 left: 25%;
                                 top: 11%;
                                 font-size:12px!important;" >                    
                                <h:outputLabel value="#{cc.attrs.bill.cancelledBill.paymentMethod}" 
                                               rendered="#{cc.attrs.bill.cancelledBill.insId ne null}" />                        
                                <h:outputLabel value="#{cc.attrs.bill.paymentMethod}" 
                                               rendered="#{cc.attrs.bill.cancelledBill.insId eq null }"/>
                            </div>

                            <div style="position: absolute;
                                 left: 73%!important;
                                 top: 11%!important;
                                 font-size: 12px!important;">
                                <h:outputLabel value="Time"/>
                            </div>
                            <div style="position: absolute;
                                 left: 82%;
                                 top: 11%;
                                 font-size:12px!important;">
                                <h:outputLabel value=":"/>
                            </div>
                            <div style="position: absolute;
                                 left: 84%;
                                 top: 11%;
                                 font-size:12px!important;" >                                                 
                                <h:outputLabel value="#{cc.attrs.bill.cancelledBill.billTime}"  
                                               rendered="#{cc.attrs.bill.cancelledBill.insId ne null}">
                                    <f:convertDateTime pattern="hh:mm a"/>
                                </h:outputLabel>                        
                                <h:outputLabel value="#{cc.attrs.bill.billTime}" 
                                               rendered="#{cc.attrs.bill.cancelledBill.insId eq null }">
                                    <f:convertDateTime pattern="hh:mm a"/>
                                </h:outputLabel>
                            </div>

                            <div style="position: absolute;
                                 left: 0%!important;
                                 top: 15%!important;
                                 font-size: 12px!important;">
                                <h:outputLabel value="Company"/>
                            </div>
                            <div style="position: absolute;
                                 left: 23%;
                                 top: 15%;
                                 font-size:12px!important;">
                                <h:outputLabel value=":"/>
                            </div>
                            <div style="position: absolute;
                                 left: 25%;
                                 top: 15%;
                                 font-size:12px!important;" >                    
                                 <p:outputLabel value="#{cc.attrs.bill.fromInstitution.name}" />
                            </div>
                            
                            <div style="position: absolute;
                                 left: 0%!important;
                                 top: 19%!important;
                                 font-size: 12px!important;">
                                <h:outputLabel value="OPD Credit Settlement" rendered="#{cc.attrs.billController.billItems.get(0).patientEncounter eq null}"/>
                                <h:outputLabel value="BHT Credit Settlement" rendered="#{cc.attrs.billController.billItems.get(0).patientEncounter ne null}"/>
                            </div>

                            <h:outputLabel value="#{cc.attrs.bill.patient.person.nameWithTitle}"
                                           style=" position: absolute;left: 25%;top: 35%;font-weight: bold;">
                            </h:outputLabel>

                            <h:outputLabel value="#{cc.attrs.bill.patient.person.phone}"
                                           styleClass="phonePrinting" >
                            </h:outputLabel>





                            <h:outputLabel value="#{cc.attrs.bill.collectingCentre.name} #{cc.attrs.bill.creditCompany.name}"
                                           styleClass="billNamePrinting"  >
                            </h:outputLabel>

                            <div style="font-size: 11px;
                                 position: absolute;
                                 left: 10%;
                                 top: 25%;" >
                                <h:dataTable value="#{cc.attrs.bill.billItems}" var="b" >                                               
                                    <p:column >                                                     
                                        <p:outputLabel style="font-size: 10px!important" value="#{b.patientEncounter.bhtNo} - " rendered="#{b.patientEncounter ne null}"/>
                                        <p:outputLabel style="font-size: 10px!important" value="#{b.referenceBill.insId}" rendered="#{b.patientEncounter eq null}"/>
                                    </p:column>
                                    <p:column headerText="Patient Name">
                                        <p:outputLabel style="font-size: 10px!important" value="#{b.referenceBill.patient.person.name}" rendered="#{b.patientEncounter eq null}"/>
                                        <p:outputLabel style="font-size: 10px!important" value="#{b.patientEncounter.patient.person.name}" rendered="#{b.patientEncounter ne null}"/>
                                    </p:column>                                              
                                </h:dataTable>
                                <p:spacer height="5px;"></p:spacer>
                                <table style="min-width:100%;">
                                    <tr>
                                        <td style="min-width: 3.5cm;text-align: left;">
                                            <h:outputLabel value="TOTAL"/>
                                        </td>
                                        <td>
                                            <h:outputLabel value="#{cc.attrs.bill.netTotal}"  style="font-size: 110%; font-weight: bold ; text-align: right">
                                                <f:convertNumber pattern="#,##0.00" />
                                            </h:outputLabel>
                                        </td>
                                    </tr>
                                </table>
                                <p:spacer height="25px;"></p:spacer>
                                <table style="min-width:100%;">
                                    <tr>
                                        <td style="min-width: 3cm; text-decoration: overline;">
                                            <p:outputLabel value="Cashier : #{cc.attrs.bill.creater.code}" style="font-size: 11px!important;"/>
                                        </td>
                                        <td style="min-width: 5cm;text-decoration: overline;width: 75%!important;" >
                                            <p:outputLabel value=""  style="font-size: 11px!important;"/>
                                        </td>
                                    </tr>
                                </table>
                            </div>

                            <div style="font-size: 11px;
                                 position: absolute;
                                 left: 80%;
                                 top: 25%;" >
                                <h:dataTable value="#{cc.attrs.bill.billItems}" var="bip1" >
                                    <h:column>
                                        <h:outputLabel value="#{bip1.netValue}"  style="font-size: 10px!important; float: right;" >
                                            <f:convertNumber pattern="#,##0.00" />
                                        </h:outputLabel>
                                    </h:column>
                                </h:dataTable>

                            </div>

                        </p:panel>
                    </div>

                </div>
            </div>
        </div>


    </cc:implementation>
</html>